#include"Stack.h"

bool isValid(char* s) {
    Stack st;
    STInit(&st);
    int i = 0;
    while (*s) {
        if (*s == '(' || *s == '[' || *s == '{')
            STPush(&st, *s);
        else
        {
            if (STEmpty(&st)) return false;
            char top = STPop(&st);
            if ((top == '(' && *s != ')') ||
                (top == '[' && *s != ']') ||
                (top == '{' && *s != '}'))
            {
                STDestroy(&st);
                return false;
            }
        }
        ++s;
    }
    if (!STEmpty(&st)) return false;
    STDestroy(&st);
    return true;
}

void test1()
{
    char* s = "()";
    isValid(s);
}

int main()
{
    test1();

	return 0;
}